<!--
 * @Descripttion: 新增退货单 - 默认界面
 * @version:
 * @Author: cxguo
 * @Date: 2019-08-17 20:26:23
 * @LastEditors: cxguo
 * @LastEditTime: 2020-11-05 13:21:01
 -->
<template>
  <div :class="{'app-container':true}">
    <el-card shadow="never">
      <div slot="header" class="header clearfix">
        <div class="text-center">
          <h1> 进货退货单 </h1>
        </div>
      </div>
      <div class="text-center">
        <p><i class="iconfont icon-icon_caigou" style="font-size:100px; color:#cccccc" /></p>
        <span class="font30 color-gay">您可以关联进货单进行退货,也可以直接选择商品进行退货。</span>
      </div>
      <div class="w300 text-center margin-w-auto paddingT20">
        <el-button type="primary" size="medium" @click="btnHasRelation">关联进货单</el-button>
        <el-button type="default" size="medium" @click="btnNoRelation">不关联</el-button>
      </div>
    </el-card>
    <el-dialog
      title="选择进货单"
      width="90%"
      height="90%"
      :visible.sync="isShowList"
      destroy-on-close
      append-to-body
    >
      <PurchaseList v-if="isShowList" operation="select" @on-select="onSelect" />
    </el-dialog>
  </div>
</template>

<script>
import { oftenuse } from '@/libs/mixins'
import PurchaseList from './waite2return'

export default {
  name: 'ReturnPurchaseDefault',
  components: { PurchaseList },
  mixins: [oftenuse],
  props: {
  },
  data() {
    return {
      isShowList: false
    }
  },
  methods: {
    btnHasRelation() {
      this.isShowList = true
    },
    btnNoRelation() {
      this.$router.push({
        name: 'PurchasereturnAddNoRelation'
      })
    },
    onSelect(row) {
      this.isShowList = false
      const { id } = row
      this.$router.push({
        name: 'PurchasereturnAddHasRelation',
        query: { billId: id }
      })
    }
  }
}
</script>
